<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户列表</title>
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700' rel='stylesheet' type='text/css'>
    <link href="__PUBLIC__/statics/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/statics/css/nifty.min.css" rel="stylesheet">
    <!--Nifty Premium Icon [ DEMONSTRATION ]-->
    <link href="__PUBLIC__/statics/css/demo/nifty-demo-icons.min.css" rel="stylesheet">
    <!--Demo [ DEMONSTRATION ]-->
    <link href="__PUBLIC__/statics/css/demo/nifty-demo.min.css" rel="stylesheet">
    <link href="__PUBLIC__/statics/plugins/ionicons/css/ionicons.min.css" rel="stylesheet">
    <!--Morris.js [ OPTIONAL ]-->
    <link href="__PUBLIC__/statics/plugins/morris-js/morris.min.css" rel="stylesheet">
    <!--Magic Checkbox [ OPTIONAL ]-->
    <link href="__PUBLIC__/statics/plugins/magic-check/css/magic-check.min.css" rel="stylesheet">
    <link href="__PUBLIC__/statics/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link href="__PUBLIC__/statics/plugins/pace/pace.min.css" rel="stylesheet">
    <script src="__PUBLIC__/statics/plugins/pace/pace.min.js"></script>
    <!--jQuery [ REQUIRED ]-->
    <script src="__PUBLIC__/statics/js/jquery-2.2.4.min.js"></script>
    <!--BootstrapJS [ RECOMMENDED ]-->
    <script src="__PUBLIC__/statics/js/bootstrap.min.js"></script>
    <!--NiftyJS [ RECOMMENDED ]-->
    <script src="__PUBLIC__/statics/js/nifty.min.js"></script>
    <script src="__PUBLIC__/statics/js/demo/nifty-demo.min.js"></script>
    <!--Morris.js [ OPTIONAL ]-->
    <script src="__PUBLIC__/statics/plugins/morris-js/morris.min.js"></script>
    <script src="__PUBLIC__/statics/plugins/morris-js/raphael-js/raphael.min.js"></script>
    <!--Sparkline [ OPTIONAL ]-->
    <script src="__PUBLIC__/statics/plugins/sparkline/jquery.sparkline.min.js"></script>
    <!--Specify page [ SAMPLE ]-->
    <script src="__PUBLIC__/statics/js/demo/dashboard.js"></script>
</head>
<!--TIPS-->
<!--You may remove all ID or Class names which contain "demo-", they are only used for demonstration. -->
<body>
<div id="container" class="effect aside-float aside-bright mainnav-lg">
	<div class="boxed">
		<div id="content-container">
			<div id="page-title">
			</div>
			<!--<ol class="breadcrumb">
				<li><a href="#">Home</a></li>
				<li><a href="#">Layouts</a></li>
				<li class="active">Collapsed Navigation</li>
			</ol>-->
			<div class="panel">
				<div class="panel-body">
					<form class="form-inline" action="javascript:;" method="post">
						<table class="table table-striped table-bordered table-hover table-condensed">
							<tr>
								<th>管理组</th>
								<td>
									{foreach name="data" item="v"}
										{$v['title']}
										<input class="xb-icheck" type="checkbox" name="group_ids" value="{$v['id']}">
										&emsp;
									{/foreach}
								</td>
							</tr>
							<tr>
								<th>姓名</th>
								<td>
									<input class="form-control" type="text" name="username" required="required">
								</td>
							</tr>
							<tr>
								<th>手机号</th>
								<td>
									<input class="form-control" type="text" name="phone" required="required">
								</td>
							</tr>
							<tr>
								<th>邮箱</th>
								<td>
									<input class="form-control" type="text" name="email" required="required">
								</td>
							</tr>
							<tr>
								<th>初始密码</th>
								<td>
									<input class="form-control" type="text" name="password" required="required">
								</td>
							</tr>
							<tr>
								<th>状态</th>
								<td>
									<span class="inputword">允许登录</span>
									<input class="xb-icheck" type="radio" name="status" value="1" checked="checked">
									&emsp;
									<span class="inputword">禁止登录</span>
									<input class="xb-icheck" type="radio" name="status" value="0">
								</td>
							</tr>
							<tr>
								<th></th>
								<td>
									<input class="btn btn-success"  type="button" onclick="return add_submit()" value="添加">
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
	<button class="scroll-top btn">
		<i class="pci-chevron chevron-up"></i>
	</button>
</div>
<script type="text/javascript" src="__LIB__/layer/2.4/layer.js"></script>
<script>
    //添加-提交
    function add_submit()
    {
        var url = "{:Url('Admin/User/addUser')}";
        var group_ids =[];
        $('input[name="group_ids"]:checked').each(function(){
            group_ids.push(this.value); //push 进数组
        });
        var username = $("[name='username']").val();
        var phone = $("[name='phone']").val();
        var email = $("[name='email']").val();
        var password = $("[name='password']").val();
        var status = $("[name='status']").val();
        var loading =layer.msg('正在提交数据，请稍后...',{time:5000});
        $.post(url,{group_ids:group_ids,username:username,phone:phone,email:email,password:password,status:status},function(data){
            layer.close(loading);
            if(data.code=='1'){
                layer.msg(data.msg,{time:2000});
                setTimeout(function(){
                    location.reload();
                },1000);
            }else{
                layer.msg(data.msg,{time:2000});
            }
        });
    }
</script>
</body>
</html>
